package com.freedom.ums.member.application.service.cmd;

import com.freedom.ums.member.domain.service.MemberService;
import com.freedom.ums.member.domain.service.WalletService;
import com.freedom.ums.member.infrastructure.enums.RegisterEnum;
import com.freedom.ums.member.infrastructure.persistence.pojo.command.app.MemberRegisterCommand;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
public class AuthCmdService {

    private final MemberService memberService;

    private final WalletService walletService;

    @Transactional(rollbackFor = Exception.class)
    public Boolean smsRegister(MemberRegisterCommand memberRegisterCommand) {
        Integer memberId = memberService.memberRegister(memberRegisterCommand.getAccount(), RegisterEnum.MOBILE);
        walletService.saveWallet(memberId);
        return null;
    }
}
